package client;
import common.Request;
import common.Response;

import java.net.*;
import java.io.*;
public class ClinetTest {
    public static void main(String[] args) throws  Exception {
        Socket s=new Socket("localhost",8888);
        InputStream in=s.getInputStream();
        OutputStream out = s.getOutputStream();

        ObjectOutputStream oout=new ObjectOutputStream(out);
        ObjectInputStream oin=new ObjectInputStream(in);
        Request r=new Request();
        r.setAction("login");
        r.put("username","admin");
        r.put("userpass","111111");
        oout.writeObject(r);
        oout.reset();
        Response resp=(Response)oin.readObject();

        if(resp.isSuccess()){
            System.out.println("登录成功");
        }else{
            System.out.println("失败,错误信息四:"+resp.getMsg());
        }
        s.close();
    }
}
